﻿{include file="public/header" /}
<body>
<div class="x-body">
  {if $show}
  <xblock>
    <a class="layui-btn"  target="_blank" href="{:url('index/Delivery/deliveryDetails',['deliverId'=>$deliveryId,'show'=>'0'])}"><i class="iconfont">&#xe718;</i> 框架页面</a>
    <button class="layui-btn" onclick="x_admin_show('选择明细','{:url(\'index/Delivery/selectOrder\',[\'deliveryId\'=>$deliveryId])}')"><i class="layui-icon"></i>添加订单</button>
    <!--<a class="layui-btn" href="javascript:location.replace(location.href);">刷新</a>-->
  </xblock>
  {/if}
  <fieldset class="layui-elem-field layui-field-title" style="margin-top: 5px;">
    <legend>送货单明细</legend>
  <div class="layui-row">
    <div class="container-wrap">
      <div class="box-1">
        <table class="layui-table">
          <thead>
          <tr>
            {if $show}
            <th width="40px;">操作</th>
            {/if}
            <!--<th>明细编号</th>-->
            <th>序号</th>
            <th>订单明细</th>
            <th width="70">送货数量</th>
            <th>内图编号</th>
            <th>外图编号</th>
            <th>图纸名称</th>
            <th>材料</th>
            <th>图纸工艺</th>
            <th>客户项目号</th>
            <th>版本</th>
            <th>下单时间</th>
            <th>申请人</th>
            <th>产品价格</th>
            <th>备注</th>
          </tr>
          </thead>
          {if $deliverOrderCount}
          <tbody>
            <?php $i = 1;?>
            <?php $count = 1; ?>
            {volist name="orderDatailInfo" id="info"}
            <tr>
              {if $show}
              <td>
                <a title="删除" href="javascript:void(0);" onclick="delete_(this,'{$info.deliveryInfoId}')" style="color: red">
                  <i  style="color:red;" class="layui-icon"></i>
                </a>
                <!--<a href="#" onclick="updateNum('{$info.deliveryInfoId}')" style="color:green;">修改</a>-->
                <a href="#" onclick="x_admin_show('修改明细','{:url(\'index/Delivery/editOrder\',[\'id\'=>$info.id,\'quantity\'=>$info.quantity,\'remarks\'=>$info.remarks])}',500,300)" style="color:green;">
                  <i style="color: green" class="layui-icon"></i>
                </a>
              </td>
              {/if}
              <?php
               $isTask = getIsTask($info['id']);
               ?>
              <!--<td>{$info.deliveryInfoId}</td>-->
              <td>{$count}</td>
              <?php $count++ ?>
              <td>{$info.orderCode}</td>
              <td>{$info.quantity}
                <!--<div class="layui-inline">-->
                  <!--<div class="layui-input-inline">-->
                    <!--<input type="number" style="width: 50px;" id="{$info.deliveryInfoId}" autocomplete="off" class="layui-input" value="{$info.quantity}">-->
                  <!--</div>-->
                <!--</div>-->
              </td>
              <td>
                <a href="javascript:;" onclick="x_admin_show('<span class=\' layui-bg-blue\'>{$info.external}</span> 的图纸明细','{:url(\'index/blueprint/blueprintInfo\',[\'codeId\'=>$info.external,\'key\'=>\'internal\'])}')" ><span style="color: #1E9FFF">{$info.external}</span></a>
              </td>
              <td>
                <a href="javascript:;" onclick="x_admin_show('<span class=\' layui-bg-blue\'>{$info.waiExternal}</span> 的图纸明细','{:url(\'index/blueprint/blueprintInfo\',[\'codeId\'=>$info.waiExternal,\'key\'=>\'externa\'])}')" ><span style="color: #1E9FFF">{$info.waiExternal}</span></a>
              </td>
              <td>{$info.drawingName}</td>
              <td>{$info.materialName}</td>
              <?php $blueprintInfoList = getOrderSelect($info['orderCode']);?>
              <td class="td-manage">



                {if $blueprintInfoList.files_state==0||$blueprintInfoList.drawing_externa_id==""||!widget('Widget/drawing_check',['drawing_id'=>$blueprintInfoList.drawing_externa_id])}<!-- 不继承或者外图继承无效 -->
                <button title="图纸" onclick="x_admin_show('图纸明细 <span class=\'layui-badge layui-bg-blue\'>{$blueprintInfoList.drawing_detail_id}</span> 的图纸文件',
          '{:url(\'index/blueprint/is_DrawingFiles\',[\'id\'=>$blueprintInfoList.id,\'key\'=>\'wai\',\'drawing_num\'=>$blueprintInfoList.drawing_detail_id])}')" href="javascript:;">
                  <span class="layui-badge layui-bg-{:widget('Widget/files_check',['id'=>$blueprintInfoList.id,'tip'=>'abroad'])}">图</span></button>
                {elseif $blueprintInfoList.files_state==1} <!-- 继承 -->
                <button title="图纸" onclick="x_admin_show('图纸明细 <span class=\'layui-badge layui-bg-blue\'>{$blueprintInfoList.drawing_detail_id}</span> 的图纸文件',
          '{:url(\'index/blueprint/is_outDrawing\',[\'id\'=>$blueprintInfoList.drawing_externa_id])}')" href="javascript:;"><span class="layui-badge layui-bg-orange">图</span></button>
                {/if}
                <button title="模型" onclick="x_admin_show('图纸明细 <span class=\'layui-badge layui-bg-blue\'>{$blueprintInfoList.drawing_detail_id}</span> 的3d模型文件',
          '{:url(\'index/blueprint/is_DrawingFiles\',[\'id\'=>$blueprintInfoList.id,\'key\'=>\'nei\',\'drawing_num\'=>$blueprintInfoList.drawing_detail_id])}')" href="javascript:;"><span class="layui-badge layui-bg-{:widget('Widget/files_check',['id'=>$blueprintInfoList.id,'tip'=>'within'])}">3D</span></button>
                <button title="程序单" onclick="x_admin_show('图纸明细 <span class=\'layui-badge layui-bg-blue\'>{$blueprintInfoList.drawing_detail_id}</span> 的程序单文件',
          '{:url(\'index/blueprint/is_DrawingFiles\',[\'id\'=>$blueprintInfoList.id,\'key\'=>\'cheng\',\'drawing_num\'=>$blueprintInfoList.drawing_detail_id])}')" href="javascript:;"><span class="layui-badge layui-bg-{:widget('Widget/files_check',['id'=>$blueprintInfoList.id,'tip'=>'engineering'])}">程</span></button>
                {if $blueprintInfoList.is_gongxu !=0}
                <button title="工"  href="javascript:;" onclick="x_admin_show('<span class=\'layui-badge layui-bg-blue\'>{$blueprintInfoList.drawing_detail_id}</span> 的工艺信息','{:url(\'index/blueprint/process\',[\'drawing_detail_id\'=>$blueprintInfoList.drawing_detail_id])}')" ><span class="layui-badge layui-bg-green">工</span></button>
                {else}
                <button title="工"  href="javascript:;" onclick="x_admin_show('<span class=\'layui-badge layui-bg-blue\'>{$blueprintInfoList.drawing_detail_id}</span> 的工艺信息','{:url(\'index/blueprint/process\',[\'drawing_detail_id\'=>$blueprintInfoList.drawing_detail_id])}')" ><span  class="layui-badge layui-bg-blue">工</span></button>
                {/if}




              </td>
              <td>{$info.client_prj_id}</td>
              <td>{$info.materialVersion}</td>
              <td>{$info.order_time}</td>
              <td>{$info.application}</td>
              <td>￥{$info.price}</td>
              <td>{$info.remarks}</td>
            </tr>
            {/volist}
          </tbody>
          {/if}
        </table>
      </div>
    </div>
  </div>
  </fieldset>
</div>
<script>
    /*删除*/
    function delete_(obj,id){
        layer.confirm('从发货单列表中删除？',function(index){
            var url = "{:url('/index/Delivery/delOrder')}";
            var postData ={"id":id};
            $.post(url,postData,function (result) {
                if(result){
                    $(obj).parents("tr").remove();
                    layer.msg('已删除!',{icon:1,time:1000});
                    $("#sx").click();
                }else {
                    layer.alert("删除失败", {icon: 5});
                }
            },"json");
        });
    }

    function updateNum(id){
        var number = $("#"+id+"").val();
        layer.confirm("明细: <span style='color: green'>"+id+"</span> <br>发货数量改为: <span style='color: green'>"+number+"</span> <br> 确认吗？",function(index){
            var url = "{:url('/index/Delivery/updateNum')}";
            var postData ={"deliveryInfoId":id,'quantity':number};
            $.post(url,postData,function (result) {
                if(result){
                    layer.msg('修改成功!',{icon:1,time:1000});
                    window.location.reload();  //刷新父级页面
                }else {
                    layer.alert("修改失败", {icon: 5});
                }
            },"json");
        });
    }
</script>
</body>
</html>